package com.ujiuye.util;

import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * CompanyName: IT优就业<br/>
 * Datetime: 2021/7/1 14:21<br/>
 *
 * @author TanJian
 */
public class JsonUtils {


    static ObjectMapper om = new ObjectMapper();
    public static String toJson(Object obj, HttpServletResponse response)throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        return om.writeValueAsString(obj);
    }
}

